package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.TravelDiscuss;
import cn.wolfcode.trip.base.service.IStrategyCommentService;
import cn.wolfcode.trip.base.service.ITravelDiscussService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("travelDiscusses")
public class TravelDiscussController {

    @Autowired
    private ITravelDiscussService travelDiscussService;

    @PostMapping
    public void insert(Long travelId, Long sourceId, String content, int type) {
        travelDiscussService.insert(travelId, sourceId, content, type);
    }

    @GetMapping
    public Object queryList(Long travelId){
        return travelDiscussService.queryList(travelId);
    }

    @GetMapping("/{targetId}")
    public Object queryListByTargetId(@PathVariable Long targetId, int type){
        return travelDiscussService.queryListByTargetId(targetId, type);
    }

    @PutMapping
    public void changeType(int type){
        travelDiscussService.changeType(type);
    }
}
